
let Koa = require('koa');
let nunjucks = require("nunjucks");
let views = require("koa-views");
let router = require("koa-router")();
let static = require("koa-static");

// 初始化一个服务器实例
let app = new Koa();

app.use(views(__dirname + "/views", {
    map: { html: "nunjucks" }
}))

app.use(static(__dirname +"/public"));

//测试bookstrap
router.get("/",async(ctx,next)=>{
    await ctx.render("default" )
      
})


//实现满屋花布局    
router.get("/mwh",async(ctx,next)=>{
   await ctx.render("index" ,{
       names : "小鹿的练习"
   } )

})





app.use(router.routes());


let port = 3000;
app.listen(port);

console.log(`http://127.0.0.1:${port}`);